﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lesson1_3
{
    class Program
    {
        static void Main()
        {
            int dod1 = 0;
            int dod2 = 0;
            int sum = 0; 
            bool result = false ;
            bool secondResult = false;
            while (!result)
            {
                Console.WriteLine("Enter first number");
                string s_dod1 = Console.ReadLine();
                try
                {
                    dod1 = int.Parse(s_dod1);
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
                result = int.TryParse(s_dod1, out dod1);               
            }
            while (!secondResult)
            {
                Console.WriteLine("Enter second number");
                string s_dod2 = Console.ReadLine();
                try
                {
                    dod2 = Convert.ToInt32(s_dod2);
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
                secondResult = int.TryParse(s_dod2, out dod2);
            }
            sum = dod1 + dod2;
            Console.WriteLine("Summary is " + sum);
            Console.ReadKey();

        }
    }
}